﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MoneyWentWhere.DataModel
{   
    public static class EnumX
    {
        public static T Parse<T>(String value)
        {
            return (T)Enum.Parse(typeof(T), value);
        }

        public static bool TryParse<T>(String value, out T item)
        {
            item = default(T);
            if (!Enum.IsDefined(typeof(T), value)) { return false; }
            item = Parse<T>(value);
            return true;
        }

    }
}
